using System;
using System.Collections.Generic;
using System.Text;
using System.BusinessObjects.Helpers;

using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;

namespace Blazing.BusinessObjects.Tests
{
    [TestClass]
    public class GeocodeTests
    {
        string GEOKML = @"<?xml version=""1.0"" encoding=""UTF-8""?><kml xmlns=""http://earth.google.com/kml/2.0""><Response><name>18 Hanlan St Surfers Paradise,Queensland,Australia</name><Status><code>200</code><request>geocode</request></Status><Placemark id=""p1""><address>18 Hanlan St, Surfers Paradise, QLD 4217, Australia</address><AddressDetails Accuracy=""8"" xmlns=""urn:oasis:names:tc:ciq:xsdschema:xAL:2.0""><Country><CountryNameCode>AU</CountryNameCode><AdministrativeArea><AdministrativeAreaName>QLD</AdministrativeAreaName><Locality><LocalityName>Surfers Paradise</LocalityName><Thoroughfare><ThoroughfareName>18 Hanlan St</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>4217</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails><Point><coordinates>153.430043,-28.003480,0</coordinates></Point></Placemark></Response></kml>";

        [TestMethod]
        public void TestCanParseKML()
        {
            Blazing.BusinessObjects.Geocode.RawObjects.kmlGeocode obj = XmlHelper.Deserialise<Blazing.BusinessObjects.Geocode.RawObjects.kmlGeocode>(GEOKML);
            Assert.AreEqual("8", obj.Items[0].Placemark[0].AddressDetails.Accuracy);
        }
    }
}
